import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    shopcart:[],
    shopdetails:{},
    iflogin:true,
    loginmsg:''
  },
  mutations: {
    saveshopdetails(state,obj){
      state.shopdetails=obj
    },
    login(state){
      state.iflogin=true
    },
    getloginmsg(state,msg){
      state.loginmsg=msg
    },
    cancelLogin(state){
      state.iflogin=false;
      state.loginmsg=''
    },
    additem(state,val){
      state.shopcart.push(val)
      // console.log(state.shopcart)
    },
    changecount(state,obj){
      let{count,index}=obj;
      state.shopcart[index].count+=count;
    }
  },
  actions: {
  },
  modules: {
  }
})
